import re
print(re.match(r'^\d{3}\-\d{3,8}$','010-12345'))

test='user input'
if re.match(r'正则表达式',test):
    print('Ok!')
else:
    print('Failed!')

#split    
print('a b  c'.split(' '))
print(re.split(r'\s+','a b  c'))
print(re.split(r'[\s\,]+','a,b, c  d'))
print(re.split(r'[\s\,\;]+','a,b;; c  d'))

#group ()
m=re.match(r'^(\d{3})-(\d{3,8})$','010-12345')
print(m)
print(m.group(0))
print(m.group(1))
print(m.group(2))

t = '19:05:30'
m = re.match(r'^(0[0-9]|1[0-9]|2[0-3]|[0-9])\:(0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|[0-9])\:(0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|[0-9])$', t)
print(m.groups())

#\d+ ,\d?
m0=re.match(r'^(\d+)(0*)$','102300').groups()
m=re.match(r'^(\d+?)(0*)$','102300').groups()
print(m0,m)

#debug  （compile）
re_tel=re.compile(r'^(\d{3})-(\d{3,8})$')
print(re_tel.match('010-12345').groups(),re_tel.match('010-8086').groups())
